package com.magicsoft.share.ui.article;

import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.magicsoft.share.R;
import com.magicsoft.share.base.BaseActivity;
import com.magicsoft.share.base.BasePresenter;

import butterknife.BindView;
import butterknife.OnClick;

public class OpenActivity extends BaseActivity {


    @BindView(R.id.view_top)
    View viewTop;
    @BindView(R.id.ibtn_left)
    ImageButton ibtnLeft;
    @BindView(R.id.tv_left)
    TextView tvLeft;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.ibtn_right)
    ImageButton ibtnRight;
    @BindView(R.id.tv_right)
    TextView tvRight;
    @BindView(R.id.radio_open)
    RadioButton radioOpen;
    @BindView(R.id.layout_open)
    RelativeLayout layoutOpen;
    @BindView(R.id.radio_open_no)
    RadioButton radioOpenNo;
    @BindView(R.id.layout_open_no)
    RelativeLayout layoutOpenNo;
    private String openStr="公开";
    private int isopen=1;

    @Override
    public BasePresenter initPresenter() {
        return null;
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_open;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        tvTitle.setText("谁可以看");

    }

    @Override
    public void requestData() {

    }


    @OnClick({R.id.ibtn_left, R.id.layout_open, R.id.layout_open_no})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ibtn_left:
                Intent intent = new Intent();
                intent.putExtra("openStr",openStr);
                intent.putExtra("isopen",isopen);
                setResult(RESULT_OK,intent);
                finish();
                break;
            case R.id.layout_open:
                isopen=1;
                openStr="公开";
                radioOpen.setChecked(true);
                radioOpenNo.setChecked(false);
                Intent intent1 = new Intent();
                intent1.putExtra("openStr",openStr);
                intent1.putExtra("isopen",isopen);
                setResult(RESULT_OK,intent1);
                finish();
                break;
            case R.id.layout_open_no:
                openStr="秘密";
                isopen=0;
                radioOpen.setChecked(false);
                radioOpenNo.setChecked(true);
                Intent intent2 = new Intent();
                intent2.putExtra("openStr",openStr);
                intent2.putExtra("isopen",isopen);
                setResult(RESULT_OK,intent2);
                finish();
                break;
        }
    }
}
